#pragma once
//-------------------------------------------------------------------------------------------------
//IImageProcStepLibDyn.h  - The interface exported by an ImageProcStep*Lib component that is accessed by Dynamic Linking         
//-------------------------------------------------------------------------------------------------
//FreeBSD License
//Copyright 2012 Will Stott All rights reserved.
//
//Redistribution and use in source and binary forms, with or without modification, are
//permitted provided that the following conditions are met:
//
//   1. Redistributions of source code must retain the above copyright notice, this list of
//      conditions and the following disclaimer.
//
//   2. Redistributions in binary form must reproduce the above copyright notice, this list
//      of conditions and the following disclaimer in the documentation and/or other materials
//      provided with the distribution.
//
//THIS SOFTWARE IS PROVIDED BY Will Stott ``AS IS'' AND ANY EXPRESS OR IMPLIED
//WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
//FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Will Stott OR
//CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
//CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
//SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
//ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
//NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
//ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
//The views and conclusions contained in the software and documentation are those of the
//authors and should not be interpreted as representing official policies, either expressed
//or implied, of Will Stott.
//
//----Authors--------------------------------------------------------------------------------------
//created by: will.stott@ucl.ac.uk Apr 2012
//
//----Comments-------------------------------------------------------------------------------------
//
//This is part of ImageExptLib but only used by ImageProcStep*Lib components. It defines the dynamic
//linked interface they all must implement so that ArchiveProc can access their functions for an 
//image processing step. Component developers will need to create a class which 
//implements IImageProcStepLibDyn - see ImageProcStepSampleLib.h/.cpp which are partly reproduced here
//
//  //........................
//	//ImageProcStepSampleLib.h
//	class IMAGEPROCSTEPSAMPLELIB_API ImageProcStepSampleLib : public IImageProcStepLibDyn
//	{
//	public:
//		ImageProcStepSampleLib::ImageProcStepSampleLib();
//		ImageProcStepSampleLib::~ImageProcStepSampleLib();
//			//virtual methods as defined by IImageProcStepLibDyn - see the body of this file
//			//other methods it needs to help implement the IImageProcStepLibDyn interface
//	private:
//		CImageProcSample  _step;
//			//other data items it needs to help implement the IImageProcStepLibDyn interface
//	};
//
//  extern "C" IMAGEPROCSTEPSAMPLELIB_API IImageProcStepLibDyn *CreateImageProcStepLib();		//use extern "C" to stop C++ name mangling
//
//  //........................
//	//ImageProcStepSampleLib.cpp
//	IMAGEPROCSTEPSAMPLELIB_API IImageProcStepLibDyn *CreateImageProcStepLib()					//note: Your library MUST contain this function, though clearly
//	{																							//you will use your own IImageProcStepLibDyn derived class  
//		return dynamic_cast<IImageProcStepLibDyn *>(new ImageProcStepSampleLib());				//rather than ImageProcSampleLib
//	}
//
//	ImageProcStepSampleLib::ImageProcStepSampleLib() 
//	{
//			
//	}
//
//	//... other methods
//
//
//ImageProcStep*Lib components will also use ImageProcStepLibAuto.h to access the classes in ImageExptLib
//which facilitate the development of their library. However, they will link their component to ImageExptLib
//using ImageExptLib.lib at build time - hence automatic Loading (aka static loading, implicit linking).
//
//-------------------------------------------------------------------------------------------------
#include <windows.h>		//define HINSTANCE

class ProcParamsInputs;
class ProcParamsOutputs;
class ImageProcStepLibAuto;

class IImageProcStepLibDyn
{
public:
	virtual const char *GetLibVersion() = 0;
	virtual const char *GetLibName() = 0;
	virtual int			GetLibInterfaceVersion() = 0;		//interface version is incremented after any change to ImageProcStepLibAuto, ProcParamsInputs or ProcParamsOutputs (or their base classes)
	
	virtual void		Delete() = 0;
	virtual bool		Run(const char *fnName, ProcParamsInputs *inputs, ProcParamsOutputs *outputs) = 0;

	virtual bool					IsApiValid() = 0;			   //if returns true, then GetLibApi() is guaranteed to return a valid pointer to a good ProcDef
	virtual ImageProcStepLibAuto   *GetLibApi() = 0;

};


//-------------------------------------------------------------------------------------------------
//			E N D   O F   F I L E
//-------------------------------------------------------------------------------------------------